//
//  CollectionCellModel.swift
//  CooperSwift
//
//  Created by 计海峰 on 2022/9/26.
//

import Foundation

/// cell 公共cell model 相当于 row
open class CollectionCellModel: NSObject, CollectionCellConfigProtocol, BindKeyProtocol {
  
    public var model: Any?
    
    var cellClass: UICollectionViewCell.Type?
    
    required public init(_ model: Any?) {
        self.model = model
    }
    
    static func initWith(_ model: Any, size: CGSize = CGSize(120, 120)) -> CollectionCellModel {
        let info = CollectionCellModel(model)
        info.cellSize = size
        return info
    }
    
    //  MARK: - 基础实现
    required public init(_ cellCls: UICollectionViewCell.Type,  _ model: Any? = nil, size: CGSize = CGSize(120, 120)) {
        super.init()
        self.cellClass = cellCls
        self.model = model
        self.cellSize = size
    }
    
    public func cellCls() -> UICollectionViewCell.Type {
        return self.cellClass.self ?? UICollectionViewCell.self
    }
        
    
}
